<?php
	//print_r($_POST);
							global $wpdb;
 							$date = $date = date('Y-m-d H:s:i');
 							
 							$hotel = array(
 							'hotelID'		=> $_POST['hotelidbooking'],
 							'typeRoom' 		=> $_POST['type_room'],
 							'max'			=> $_POST['adults'],
 							'numberOfroom'	=> $_POST['number_of_room'],
 							'checkIn'		=> $_POST['yr_check_in_date'].'-'.$_POST['mo_check_in_date'].'-'.$_POST['dy_check_in_date'].' 00:00:00',
 							'checkOUT'		=> $_POST['yr_check_out_date'].'-'.$_POST['mo_check_out_date'].'-'.$_POST['dy_check_out_date'].' 00:00:00',
 							'date'				=> $date
 							);
 							
 							$customer = array(
 							'customerName'			=> stripslashes($_POST['customerName']),
 							'customerEmail'			=> stripslashes($_POST['customerEmail']),
 							'customerAddress'		=> stripslashes($_POST['customerAddress']),
 							'customerPhone'			=> stripslashes($_POST['customerPhone']),
 							'customerFax'			=> ' ',
 							'customerComment'		=> stripslashes($_POST['customerMessage']),
 							'guestParent'			=> 0,
 							'date'					=> $date	
 							);

 							$payments = $_POST['currentPayment'];
 							if(!$payments)
 								$payments = 'Pay in cash';
 							$payment = array(
 							'price'			=> $_POST['hidden_hotel_price'],
 							'deposit'		=> $_POST['hidden_hotel_deposit'],
 							'paymentMethod'	=> $payments,
 							'paymentCurrent'	=>'0',
 							'paymentStatus' => 'Pending',
 							'date'	=> $date	
 							);
 							 							
 							$customerID = db_insert_data("customers",$customer,$date);
 							$tourID		= db_insert_data("hotels",$hotel,$date);
 							$paymentID  = db_insert_data("payments",$payment,$date); 							
 							
 							$order = array(
 							'customerID' 		=> $customerID,
 							'itemID'			=> $tourID,
 							'paymentID'			=> $paymentID,
 							'orderStatus'		=> 'Pending',
 							'orderType'			=> 2,  // tour=1,hotel=2
 							'date'				=> $date
 							); 
 							$orderID = db_insert_data("orders",$order,$date); 	
 							include TEMPLATEPATH.'/mails/xtemplate-email-booked-hotel.php';						
?>